Prior to running this file, run:
to update the data for the most recent year. You will also need to have:
as helper files.
Set the data year year
The xlsx version of the file is used to pull the species codes: fish_codes, swath_codes, kelp_codes.
HOWEVER, at present read_xlsx incorrectly loads the data files because the SIDE/AREA column has both numbers and letters. read_xlsx turns these into NAs. This change messes up the transect area calculations and doubles the estimated densities…incorrectly of course. I haven’t figured out how to fix that yet.
This chunk will load the species codes and run the update files to turn the raw data files into counts by size and transect. Once you’ve run it, you can turn of the data processing part and just load the species codes. Runs:
Bring in the initially processed data
I set some common settings here. The settings.rds file ports the same info over to the multivariate rmd. It is brought in and updated here.
Raw data are fish counts by size, so there are multiple observations per species per transect. Sum up counts by transect.
Minimum vis for fish analysis = 2-m
Kelp depths = 5 -m Fish depths = 5, 10 -m Inv depths = 5 -m
Visibility data for 2015 are fake. DI was bad and set at 1.0 m; other sites set at 3.0 m
Mean abundance of YOY rockfish, averaged across all sites.
## `summarise()` has grouped output by 'site', 'year'. You can override using the
## `.groups` argument.
## `summarise()` has grouped output by 'year'. You can override using the
## `.groups` argument.
## Joining with `by = join_by(taxa)`
Species mean abundance across sites for depths listed below.
Fish depth = 5, 10
## Joining with `by = join_by(taxa)`
Species mean abundance by site x year x depth
## Joining with `by = join_by(taxa)`
## YOY rockfish abundance - site x year x depth
Species mean abundance by site x year x depth
## Joining with `by = join_by(taxa)`
# ALGAE & INVERT DATA
Summarize kelp and invert data to get count by transect. Raw files has more detailed observations. Data are imported above.
Kelp depth = 5
A bunch more summarizing at different scales. Also output for multivariate analyses.
## `summarise()` has grouped output by 'year', 'site', 'transect', 'species',
## 'zone', 'area'. You can override using the `.groups` argument.
## `summarise()` has grouped output by 'year', 'site', 'species', 'zone', 'area'.
## You can override using the `.groups` argument.
## `summarise()` has grouped output by 'year', 'site', 'species', 'zone'. You can
## override using the `.groups` argument.
## Joining with `by = join_by(site)`
Not sure why I started with this, but the figure is Nereocystis stipe counts at Tatoosh Island.
### Averaged across depths
## `summarise()` has grouped output by 'year', 'site', 'species'. You can override
## using the `.groups` argument.
Essentially total canopy kelp stipe counts at all sites. Bit odd and not used because of difference in Macro and Nero stipes.
## `summarise()` has grouped output by 'year', 'site', 'zone'. You can override
## using the `.groups` argument.
## `summarise()` has grouped output by 'year', 'site'. You can override using the
## `.groups` argument.
Stipe counts across site and year for each species separatey.
Just a subset of the plot above.
Mean stipe count across sites for the big three algae
## `summarise()` has grouped output by 'site', 'year'. You can override using the
## `.groups` argument.
## `summarise()` has grouped output by 'year'. You can override using the
## `.groups` argument.
Same as above but subset out for just 5 m. Mean ignroes 10-m transects.
## `summarise()` has grouped output by 'site', 'year'. You can override using the
## `.groups` argument.
## `summarise()` has grouped output by 'year'. You can override using the
## `.groups` argument.
### Kelp summed coastwide mean
## `summarise()` has grouped output by 'site', 'year'. You can override using the
## `.groups` argument.
Start with some data manipulations to sum up species by transect.
Table is count of Pycnopodia by year.
## `summarise()` has grouped output by 'year', 'site', 'transect', 'observer',
## 'species', 'zone', 'area', 'taxa'. You can override using the `.groups`
## argument.
## `summarise()` has grouped output by 'year', 'site', 'species', 'zone', 'area'.
## You can override using the `.groups` argument.
## # A tibble: 9 × 2
## year no
## <dbl> <dbl>
## 1 2015 0
## 2 2016 4
## 3 2017 0
## 4 2018 3
## 5 2019 1
## 6 2021 0
## 7 2022 0
## 8 2023 1
## 9 2024 1
Total urchins by site by year. total urchins = purple + red + green
Mean across depth zones
## `summarise()` has grouped output by 'year', 'site', 'transect', 'observer',
## 'area'. You can override using the `.groups` argument.
## `summarise()` has grouped output by 'year', 'site', 'area'. You can override
## using the `.groups` argument.
## `summarise()` has grouped output by 'year', 'site', 'transect', 'observer',
## 'area'. You can override using the `.groups` argument.
## `summarise()` has grouped output by 'year', 'site'. You can override using the
## `.groups` argument.
### Total urchins by site x year x depth
## `summarise()` has grouped output by 'year', 'site', 'transect', 'observer',
## 'zone', 'area'. You can override using the `.groups` argument.
## `summarise()` has grouped output by 'year', 'site', 'zone', 'area'. You can
## override using the `.groups` argument.
## `summarise()` has grouped output by 'year', 'site', 'transect', 'observer',
## 'area', 'zone'. You can override using the `.groups` argument.
## `summarise()` has grouped output by 'year', 'site', 'zone'. You can override
## using the `.groups` argument.
Mean urchin density across all sites. Species summed because mostly purple urchins.
## `summarise()` has grouped output by 'year', 'site', 'transect', 'observer',
## 'area'. You can override using the `.groups` argument.
## `summarise()` has grouped output by 'year'. You can override using the
## `.groups` argument.
## Joining with `by = join_by(year)`
## `summarise()` has grouped output by 'year', 'site', 'transect', 'observer',
## 'area'. You can override using the `.groups` argument.
## `summarise()` has grouped output by 'year', 'site', 'area'. You can override
## using the `.groups` argument.
## `summarise()` has grouped output by 'year', 'site', 'transect', 'observer',
## 'area'. You can override using the `.groups` argument.
## `summarise()` has grouped output by 'year', 'site'. You can override using the
## `.groups` argument.
## Adding missing grouping variables: `site`, `species`
## Adding missing grouping variables: `site`
## Joining with `by = join_by(site, year)`
Max total urchin density at Tatoosh
5-m = 4.0503465 m^-2 10-m = 10.0752194 m^-2
Moslty at Tatoosh. Mostly purple urchins.
## `summarise()` has grouped output by 'year', 'site', 'transect', 'observer',
## 'zone', 'area'. You can override using the `.groups` argument.
## `summarise()` has grouped output by 'year', 'site', 'zone'. You can override
## using the `.groups` argument.
Max total urchin density at Tatoosh
5-m = 3.7336798 m^-2 10-m = 9.5052194 m^-2
Mean density averaged across sites for a year by species.
## `summarise()` has grouped output by 'site', 'year'. You can override using the
## `.groups` argument.
## `summarise()` has grouped output by 'year'. You can override using the
## `.groups` argument.
Purple urchin density in 2015 = 0.0116667 urchins per m^2 Purple urchin density in 2019 = 1.7637508 urchins per m^2
Increase was 151.1786432 fold.
Purple urchin density in 2015 = 0.8145345 urchins per m^2
Density compared to 2015 was 69.8172403 fold.
Sum of all observed seastars. Not species.
## `summarise()` has grouped output by 'year', 'site', 'transect', 'observer',
## 'area', 'zone'. You can override using the `.groups` argument.
## `summarise()` has grouped output by 'year', 'site', 'zone'. You can override
## using the `.groups` argument.
## `summarise()` has grouped output by 'site', 'year'. You can override using the
## `.groups` argument.
## `summarise()` has grouped output by 'year'. You can override using the
## `.groups` argument.
### Subset of seastars blood, brood, leather
## `summarise()` has grouped output by 'site', 'year'. You can override using the
## `.groups` argument.
## `summarise()` has grouped output by 'year'. You can override using the
## `.groups` argument.
## `summarise()` has grouped output by 'site', 'year'. You can override using the
## `.groups` argument.
## `summarise()` has grouped output by 'year'. You can override using the
## `.groups` argument.
## `summarise()` has grouped output by 'site', 'year'. You can override using the
## `.groups` argument.
## `summarise()` has grouped output by 'year'. You can override using the
## `.groups` argument.
## `summarise()` has grouped output by 'year', 'site', 'transect', 'observer',
## 'zone', 'area'. You can override using the `.groups` argument.
## `summarise()` has grouped output by 'year', 'site', 'zone'. You can override
## using the `.groups` argument.
Not yet transformed to wide format in order to retain SD & SE info upon saving out. Transform in the Multiariate analysis rmd.
Output data files to use for multivariate ordinations.
Use these files and not raw files. Kelp and invert data have been converted to density to account for different transect lengths etc.
## # A tibble: 468 × 37
## # Groups: site, year, area, zone, transect [468]
## year site transect area zone AUFL BAIT CHNU CITH COTT EMBI GOBI
## <dbl> <fct> <int> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 2016 Destruc… 1 N 10 0 0 0 0 0 0 0
## 2 2016 Destruc… 2 N 10 0 0 0 0 0 0 0
## 3 2016 Destruc… 3 N 10 0 0 0 0 0 0 0
## 4 2017 Destruc… 1 N 5 0 0 0 0 0 13 0
## 5 2017 Destruc… 4 N 5 0 0 0 0 0 2 0
## 6 2017 Destruc… 1 S 5 0 0 0 0 0 1 0
## 7 2017 Destruc… 2 S 5 0 0 0 0 0 4 0
## 8 2019 Destruc… 1 N 5 0 0 0 0 0 2 0
## 9 2019 Destruc… 2 N 5 0 0 0 0 0 0 0
## 10 2019 Destruc… 3 N 5 0 0 0 0 0 6 0
## # ℹ 458 more rows
## # ℹ 25 more variables: HEXA <dbl>, NO_DATA <dbl>, OPEL <dbl>, PHOL <dbl>,
## # RIMU <dbl>, RYOY <dbl>, SCMA <dbl>, SEBSPP <dbl>, SEBSPPyoy <dbl>,
## # SEBYTyoy <dbl>, SECA <dbl>, SECAyoy <dbl>, SEFL <dbl>, SEMA <dbl>,
## # SEMAyoy <dbl>, SEME <dbl>, SEMY <dbl>, SEMYyoy <dbl>, SENE <dbl>,
## # SENEyoy <dbl>, SEPI <dbl>, SEPIyoy <dbl>, TOTyoy <dbl>, UNID <dbl>,
## # SEBYT <dbl>
## # A tibble: 495 × 20
## # Groups: year, site, transect, zone, area [495]
## year site transect area zone AGAFIM ALAMAR COSCOS CYMTRI DESSPP EGRMEN
## <dbl> <fct> <int> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 2015 Neah Bay 1 D 5 0 0 0 0 0 0
## 2 2015 Neah Bay 2 D 5 0 0 0 0 0 0
## 3 2015 Tatoosh… 1 D 5 0 0 0 0 0 0
## 4 2015 Tatoosh… 2 D 5 0 0 0 0 0 0
## 5 2015 Cape Al… 1 D 5 0 0 0 0 0 0
## 6 2015 Cape Al… 2 D 5 0 0 0 0 0 0
## 7 2015 Cape Jo… 1 D 5 0 0 0 0 0 0
## 8 2015 Cape Jo… 2 D 5 0 0 0 0 0 0
## 9 2015 Destruc… 1 D 5 0 0 0.133 0 0 0
## 10 2015 Destruc… 2 D 5 0 0 0.025 0 0.0167 0
## # ℹ 485 more rows
## # ℹ 9 more variables: LAMSET <dbl>, MACPYR <dbl>, NERLUE <dbl>, NO_ALG <dbl>,
## # PLEGAR <dbl>, PTECAL <dbl>, SACGRO <dbl>, SACLAT <dbl>, dPTECAL <dbl>
## # A tibble: 497 × 33
## # Groups: year, site, transect, zone, area [497]
## year site transect area zone Pisaster Pycnopodia Stylasterias anemone
## <dbl> <fct> <int> <chr> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 2015 Neah Bay 1 D 5 0 0 0 0
## 2 2015 Neah Bay 2 D 5 0 0 0 0
## 3 2015 Tatoosh … 1 D 5 0 0 0 0.00556
## 4 2015 Tatoosh … 2 D 5 0.00556 0 0 0.0111
## 5 2015 Cape Ala… 1 D 5 0.00370 0 0 0
## 6 2015 Cape Ala… 2 D 5 0 0 0 0
## 7 2015 Cape Joh… 1 D 5 0 0 0 0
## 8 2015 Cape Joh… 2 D 5 0 0 0 0.00370
## 9 2015 Destruct… 1 D 5 0 0 0 0
## 10 2015 Destruct… 2 D 5 0.0111 0 0 0.00741
## # ℹ 487 more rows
## # ℹ 24 more variables: barnacle <dbl>, bivalve <dbl>, `blood star` <dbl>,
## # `brood star` <dbl>, chiton <dbl>, crabs <dbl>, cucumber <dbl>,
## # `green urchin` <dbl>, hermit_crabs <dbl>, `kelp crab` <dbl>,
## # `large star` <dbl>, `leather star` <dbl>, `medium star` <dbl>,
## # mobile_invert <dbl>, nudibranch <dbl>, octopus <dbl>,
## # `purple urchin` <dbl>, `red urchin` <dbl>, sea_star_YOY <dbl>, …
## `summarise()` has grouped output by 'year'. You can override using the
## `.groups` argument.
## `summarise()` has grouped output by 'year'. You can override using the
## `.groups` argument.
## `summarise()` has grouped output by 'year'. You can override using the
## `.groups` argument.
## # A tibble: 45 × 5
## # Groups: Year [9]
## Year Site Fish Kelp Invertebrates
## <dbl> <fct> <dbl> <dbl> <dbl>
## 1 2015 Cape Johnson 2 2 2
## 2 2015 Cape Alava 2 2 2
## 3 2015 Tatoosh Island 2 2 2
## 4 2015 Neah Bay 2 2 2
## 5 2015 Destruction Island NA 2 2
## 6 2016 Destruction Island 3 7 7
## 7 2016 Cape Johnson 10 13 13
## 8 2016 Cape Alava 12 10 10
## 9 2016 Tatoosh Island 8 9 9
## 10 2016 Neah Bay 10 10 10
## # ℹ 35 more rows
combind fish and kelp in wide format using fish COUNT data. include area info for fish and kelp
## `summarise()` has grouped output by 'site', 'year', 'zone', 'area', 'transect'.
## You can override using the `.groups` argument.
## `summarise()` has grouped output by 'site', 'year', 'zone', 'area'. You can
## override using the `.groups` argument.
## [1] 123 36
## [1] 4656
## `summarise()` has grouped output by 'site', 'year', 'area', 'zone'. You can
## override using the `.groups` argument.
## [1] 160 20
## Joining with `by = join_by(site, year, zone, area)`
## [1] 123 52
For algae, basically only the big three have any abundance to analyze.
## `summarise()` has grouped output by 'species'. You can override using the
## `.groups` argument.
Note, the y-axes are very different
## `summarise()` has grouped output by 'taxa'. You can override using the
## `.groups` argument.
for multivariate analysis; cut and paste to that file
fish.spp = c(“OPEL”, “HEXA”, “SECA”, “SCMA” ,“SENE”, “SEME”, ‘EMBI’,‘GOBI’)
yoy.spp = c(“SECAyoy”, “SEPIyoy”, “SEMYyoy”, “SEBYTyoy”,“RYOY”)
## `summarise()` has grouped output by 'species'. You can override using the
## `.groups` argument.
## Joining with `by = join_by(species)`
Species Common name size_class Group Total
## Joining with `by = join_by(species)`
## # A tibble: 6 × 3
## spp Density SD
## <chr> <dbl> <dbl>
## 1 Pterygophora californica 1.09 1.34
## 2 Nerocystis leutkeana 0.605 1.34
## 3 Macrocystis pyrifera 0.520 1.33
## 4 Laminaria setchellii 0.141 0.431
## 5 Saccharina groenlandica 0.124 0.541
## 6 Pleurophycus gardneri 0.112 0.398
## # A tibble: 6 × 4
## Species Taxa Density SD
## <chr> <chr> <dbl> <dbl>
## 1 Balanus nubilis barnacle 0.824 3.28
## 2 Strongylocentrotus purpuratus purple urchin 0.786 2.93
## 3 Nucella lamellosa shelled gastropod 0.197 1.09
## 4 Mesocentrotus franciscanus red urchin 0.140 0.605
## 5 Styela montereyensis tunicate 0.130 0.183
## 6 Cucumaria miniata cucumber 0.107 0.156
Imports data file from other R file. Plot just kelp canopy. Add to ggarrange below.
There is a discrepancy between the DNR data and kelpwatch data. Need to
check on it.
## Scale for x is already present.
## Adding another scale for x, which will replace the existing scale.
Mean ha for 2004-2013: 700.6700019 ha +/- 43.6630069 s.e.
Total canopy 2014: 337.2999981 ha
Drop from previous decade: 0.4813964 % of previous cover.
Mean ha for 2015-2020:659.7333332 ha +/- 33.9434596 s.e.
Compared to earlier decade: 0.941575 % of previous cover.
Totals 2014 for Total, Nereo, Macro = 337.2999981, 89.6000009, 247.8999973 ha Totals 2020 for Total, Nereo, Macro = 701.8, 383.4, 318.6 ha
Change was 2.0806404, 4.2790178, 1.2851957 fold.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## Scale for y is already present.
## Adding another scale for y, which will replace the existing scale.
## [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10"
## `summarise()` has grouped output by 'year'. You can override using the
## `.groups` argument.
## Scale for x is already present. Adding another scale for x, which will replace
## the existing scale.
### Kelp
### Kelp and SST combinded figure